
// let const 

// 块级作用域
 
{
    let a = 123;
    var b = 456
}

// console.log(a) // ** ReferenceError: a is not defined
console.log(b) // 456

// 不存在变量提升
console.log(a1) // undefined
// console.log(b1) // ** ReferenceError: Cannot access 'b1' before initialization
var a1
let b1

// 暂时性锁区
var a3 = 'tmp';
if(true){
    // console.log(a3) // ** ReferenceError: Cannot access 'a3' before initialization
    // a3 = '123' // ** ReferenceError:
    let a3
    a3 = 'xixixi' // xixixi
}

// 不允许重复声明

var a4 = 'a4'
// let a4 = 'aa4' // SyntaxError: Identifier 'a4' has already been declared

let b4 = 'b4'
// let b4 = 'bb4' // SyntaxError: Identifier 'b4' has already been declared

// const
// const实际上保证的，并不是变量的值不得改动，而是变量指向的那个内存地址所保存的数据不得改动